
    $.ajax({
        type:'GET',
        cache:false,
        dataType:"jsonp",
        url:user_wbiao_cn + 'goods'+'/'+'sell_status'+'/',
        data:{ goods_id: $("#goods_id").val(), act:getQueryString('act'), token:"5fdbe7ca2ea3766235d59da6184113cc" },
        success: function(data){
            //购物按钮
            show_buttons(parseInt(data.s));
            //显示是否支持到付
            if(parseInt(data.h) == 1 && data.p <= 20000)
                $('#is_post_pay').show();
            //data说明：
            //s销售状态，m市场价，t是否促销，r价格名称，o原价，p商品价格，f分期价，v节省，d折扣，i活动折扣，a活动价格，y闪电发货，n活动说明，x商品名称前缀，b是否独代, j促销信息数组

//            $(price).after('<a id="promote_price_notice" href="/goods/promote_notice?goods_id='+$("#goods_id").val()+'&t='+(new Date().getTime())+'" class="iframe blue">&nbsp; (促销通知)</a>');

            //价格名称
            var price = $("#price");
            var price_name = $("#price_name");
            var promote_name =data.r;
            if(data.t==1){
                price_name.html((has_act_price ? '' : '<span style="color:red;">') + (promote_name == '' ? '促销价' : promote_name) + '' + (has_act_price ? '' : '</span>'));
            }else if(data.y==1){
                price_name.html((promote_name == '' ? '欧洲同步价' : promote_name));
            }else{
                price_name.html('喜悦手表价');
            }
            var price_html = data.p > 0 ? ('<font class="f12">￥</font>' + data.p) : '-';
            //促销通知
            price.html(price_html);

            //活动价
            var has_act_price = data.a > 0 && data.a != data.p;
            if(has_act_price){
                price_name.text('活动价').addClass('red');
                price.html("<font class='f12'>￥</font>" + data.a);
                //$("#act_price").html("<font class='f12'>￥</font>" + data.a);
                //$("#act_discount").html(data.i + '折');
                //$("#act_price_container").show();
                //$("#wbiao_price").hide();
                //price.css("color", "#888").css("font-size", "12px").css("text-decoration", "line-through");
            }

            /*Begin 此处为促销信息 Cale*/
            low_price = 0;
            if(data.a>0){ //市价-活动价
                low_price = data.m-data.a;
            }else if(data.p>0){ //市价-促销价
                low_price = data.m-data.p;
            }else{
                low_price = 0;
            }


            var promote_info = $('#promote-info');
            promote_content = '';
            if(low_price>0){
                //promote_content += '<div><i>直降</i><ins>已优惠￥'+low_price+'</ins></div>';
            }
            if($.isEmptyObject(data.j)==false){ //返回是空数组不显示
                $promote_arr = data.j;
                for(var $i=0; $i<$promote_arr[0].length; $i++){
                    if(typeof($promote_arr[3])!=='undefined' && typeof($promote_arr[4])!=='undefined'){
                        if($promote_arr[3][$i]<data.z && $promote_arr[4][$i]>data.z){
                            promote_content += '<div>';
                            promote_content += '<i>'+$promote_arr[0][$i]+'</i><ins>'+$promote_arr[1][$i]+'</ins>';
                            promote_content += $promote_arr[2][$i]=='' ? '' : '&nbsp;&nbsp;<a href="'+$promote_arr[2][$i]+'" class="blue" style="font-family:宋体;" target="_blank">&gt;&gt;详细</a>';
                            promote_content += '</div>';
                        }
                    }
                }
            }
            if(promote_content.length>0){ //有内容才显示标题
                promote_info.html('<div class="sc s13"><span class="sl fl">促销</span><span class="sx fl">'+promote_content+'</span></div>').show();
            }
            /*End*/

            //折扣
            var discount = $("#discount");
            var discount_container = $("#discount_container");
            if(data.d > 0 && data.d < 10){
                discount.html(data.d + '折');
                discount_container.show();
            }else{
                discount_container.hide();
            }

            //市场价
            var market_price = $("#market_price");
            var market_price_container = $("#market_price_container");
            if(data.p!=data.m){
                var market_price_html = data.m > 0 ? ('￥' + data.m) : '-';
                market_price.html(market_price_html);
                market_price_container.show();
            }else{
                market_price_container.hide();
            }

            //分期价
            var fen_qi_jia = $("#fen_qi_jia");
            var fen_qi_jia_container = $("#fen_qi_jia_container");
            if(data.f>0){
                fen_qi_jia.text('￥' + data.f + ' × 12期');
                fen_qi_jia_container.show();
            }else{
                fen_qi_jia.text('-');
                fen_qi_jia_container.hide();
            }

            //闪电发货
            if(data.y == 1){
                $("#quick").show();
                //  $("#quick2").show();
                //  $("#quick3").show();
            }else{
                $("#quick").hide();
                //  $("#quick2").hide();
                //  $("#quick3").hide();
            }

            if(data.b == 1){
                $('#image img').after('<span class="agency" style="display:block;">喜悦手表独家代理</span>');
            }

            //活动提示
            //if(data.n != '') $("#activity_note").html("<ul><li><i>【活动】</i>"+data.n+"</li></ul>").show();

            //商品名称前缀
            if(data.x != '' && data.a > 0 && data.a < data.p) $("#goods").find("h1").prepend(data.x);

            //促销通知弹出层
            $('#promote_price_notice').fancybox({
                'titleShow': false,
                'width': 504,
                'height': 305,
                'padding': 0,
                'margin': 0,
                'scrolling':'no',
                'hideOnOverlayClick': false,
                'showCloseButton':false
            });

                        $.ajax({
                type:'GET',
                cache:false,
                dataType:"jsonp",
                url:user_wbiao_cn + 'goods'+'/'+'update_click_count'+'/',
                data:{ goods_id: $("#goods_id").val(), s:data.s, token:"5fdbe7ca2ea3766235d59da6184113cc" },
                success: function(data){
                }
            });

        }
    });
    my_browse_history();

    //立即购买
    $("#buy_now").click(function(){
        var act = getQueryString('act');
        if(act == null){act = '';}
        var goodsNumbers = $('input[name="goods_number"]').val();
        $.post(www_domain + "/cart"+"/buy_now", {goods_id: $('#goods_id').val(), goods_number: goodsNumbers, is_ajax : "1", act : act },
            function(result){
                if(result.errors!=0){
                    alert(result.message);
                }else{
                    pop_login(result);
                }

            }, "json");
    });

    //立即购买
    /*$("#real_buy_now").fancybox({
        'padding': 0,
        'titleShow': false,
        'width': 504,
        'height': 446,
        'padding': 0,
        'margin': 0,
        'scrolling':'no',
        'hideOnOverlayClick': false,
        'showCloseButton':false
    });*/

    function show_buttons(sell_status){
        //jinzhong 2013-10-14 礼品的不上架
        if($("#goods_id").val() == 27054 ||
            $("#goods_id").val() == 29393 ||
            $("#goods_id").val() == 29834 ||
            $("#goods_id").val() == 29833 ||
            $("#goods_id").val() == 29837 ||
            $("#goods_id").val() == 29838 ||
            $("#goods_id").val() == 27693
            ){
            sell_status = 4;
        }

        switch(sell_status){
            case 1:
                show_buy_now_button(); //购买
                break;
            case 2:
                show_pre_sale_button(); //预订
                break;
            case 3:
                show_sale_out_button(); //售罄
                break;
            case 4:
                show_no_sale_button(); //暂无销售
                break;
            case 5:
                show_replenish_button(); //补货中
                break;
            case 6:
                show_stop_pro_button(); //停产
                break;
            default:
                alert("抱歉！找不到当前商品或当前商品已删除！");
                break;
        }
    }

    function show_buy_now_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").show();
    }

    function show_pre_sale_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").hide();

        //预售中，我要购买
        $("#real_pre_sale").fancybox({
            'titleShow': false,
            'width': 808,
            'height': 418,
            'padding': 0,
            'margin': 0,
            'scrolling':'no',
            'hideOnOverlayClick': false,
            helpers : {
                overlay:{
                    closeClick : false,
                    fixed:!1
                }
            }
        });

        $("#pre_sale").click(function(){
            $("#real_pre_sale").click();
        }).show();
    }

    function show_sale_out_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").hide();

        $("#sale_out").show(); //已售完
    }

    function show_no_sale_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").hide();

        $("#no_sale").show(); //已售完
    }

    function show_replenish_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").hide();

        //预售中，我要购买
        $("#real_pre_sale").fancybox({
            'titleShow': false,
            'width': 808,
            'height': 418,
            'padding': 0,
            'margin': 0,
            'scrolling':'no',
            'hideOnOverlayClick': false,
            helpers : {
                overlay:{
                    closeClick : false,
                    fixed:!1
                }
            }
        });

        //补货中
        $("#replenish").click(function(){
            $("#real_pre_sale").click();
        }).show();

    }

    function show_stop_pro_button(){
        $("#buy_now, #add_to_cart, #buy_now_son").hide();

        $('#stop_pro').show(); //停产
    }
